/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qsdm.es.persistence;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author alberto
 */
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
@Entity
@Table(name = "calendariocurso", catalog = "qsdm", schema = "")

@NamedQueries({
    @NamedQuery(name = "Calendariocurso.findAll", query = "SELECT c FROM Calendariocurso c"),
    @NamedQuery(name = "Calendariocurso.findByMes", query = "SELECT c FROM Calendariocurso c WHERE c.calendariocursoPK.mes = :mes"),
    @NamedQuery(name = "Calendariocurso.findByCursoid", query = "SELECT c FROM Calendariocurso c WHERE c.calendariocursoPK.cursoid = :cursoid")})
public class Calendariocurso implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected CalendariocursoPK calendariocursoPK;
    @JoinColumn(name = "Curso_id", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Curso curso;

    public Calendariocurso() {
    }

    public Calendariocurso(CalendariocursoPK calendariocursoPK) {
        this.calendariocursoPK = calendariocursoPK;
    }

    public Calendariocurso(int mes, int cursoid) {
        this.calendariocursoPK = new CalendariocursoPK(mes, cursoid);
    }

    public CalendariocursoPK getCalendariocursoPK() {
        return calendariocursoPK;
    }

    public void setCalendariocursoPK(CalendariocursoPK calendariocursoPK) {
        this.calendariocursoPK = calendariocursoPK;
    }

    public Curso getCurso() {
        return curso;
    }

    public void setCurso(Curso curso) {
        this.curso = curso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (calendariocursoPK != null ? calendariocursoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Calendariocurso)) {
            return false;
        }
        Calendariocurso other = (Calendariocurso) object;
        if ((this.calendariocursoPK == null && other.calendariocursoPK != null) || (this.calendariocursoPK != null && !this.calendariocursoPK.equals(other.calendariocursoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.qsdm.es.persistence.Calendariocurso[ calendariocursoPK=" + calendariocursoPK + " ]";
    }
    
}
